import { HTTP } from '../utils/http.js'
import Config from '@/config/index.js'
let http = new HTTP()

/* 
	@desc 获取站点配置信息列表
	@param  ParentId	父级节点ID 	integer	None.
			layers		节点深度 	integer	None.
 */
export const getGuideSiteList = (data) => {
	return http.request({
		url: '/API/Article/GetArticleCategoryList',
		method: 'POST',
		data
	})
}

/* 
	@desc 获取站点配置信息详情
 */
export const getGuideSiteDetail = (data) => {
	return http.request({
		url: '/API/GuideSite/GetDetail',
		method: 'POST',
		data
	})
}


/*
 * @desc 文件上传
 */
export const uploadFile = ({path}) => {
	console.log(path)
	return new Promise((reslove, reject) => {
		uni.uploadFile({
			url: Config.baseUrl + '/API/Users/PictureUpload',
			filePath: path,
			fileType: 'image',
			name: 'file',
			success: (res) => {
				//上传成功
				// 通过文件名获取url
				reslove(res)
			},
			fail: (err) => {
				reject(err)
			}
		});

	})
}

export const getJsApiTicket = (data) => {
	return http.request({
		url: '/API/WeiXin/GetJsApiTicket',
		method: 'POST',
		data
	})
}
